home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-09-04 | 907 b | 52 lines | [TEXT/CWIE] |
- unit MyAssertions;
-
- interface
-
- uses
- Types;
-
- procedure Assert (b: boolean);
- procedure AssertValidPtr (p: univ ptr);
- procedure AssertValidPtrNil (p: univ ptr);
- procedure AssertValidHandle (hhhh: univ handle);
- procedure AssertValidHandleNil (hhhh: univ handle);
-
- implementation
-
- uses
- Memory;
-
- procedure Assert (b: boolean);
- begin
- if not b then begin
- DebugStr('Assert Failed;sc;hc');
- end;
- end;
-
- procedure AssertValidPtr (p: univ ptr);
- begin
- Assert((p <> nil) & (not odd(ord(p))));
- end;
-
- procedure AssertValidPtrNil (p: univ ptr);
- begin
- if p <> nil then begin
- AssertValidPtr(p);
- end;
- end;
-
- procedure AssertValidHandle (hhhh: univ handle);
- begin
- AssertValidPtr(hhhh);
- AssertValidPtr(hhhh^);
- Assert(RecoverHandle(hhhh^) = hhhh);
- end;
-
- procedure AssertValidHandleNil (hhhh: univ handle);
- begin
- if hhhh <> nil then begin
- AssertValidHandle(hhhh);
- end;
- end;
-
- end.